import { BrowserModule } from '@angular/platform-browser';
import { NgModule, Component } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { IconsProviderModule } from './icons-provider.module';
import { NgZorroAntdModule, NZ_I18N, zh_CN } from 'ng-zorro-antd';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { registerLocaleData, LocationStrategy, HashLocationStrategy } from '@angular/common';
import zh from '@angular/common/locales/zh';
import { LoginComponent } from './pages/login/login.component';
import { BaseInterceptor } from './core/net/base-interceptor';
import { CoreModule } from './core/core.module';
import { SystemManageModule } from './pages/system-manage/system-manage.module';
import { SearchMaintainModule } from './pages/search-maintain/search-maintain.module';
import { ComponentsModule } from './components/components.module';
import {
    SwiperModule, SwiperConfigInterface,
    SWIPER_CONFIG
} from 'ngx-swiper-wrapper';
import { MainChannelDiversionComponent } from './pages/main-channel-diversion/main-channel-diversion.component';
import { IrrigationComponent } from './pages/irrigation/irrigation.component';
import { NgxXLSXModule } from '@notadd/ngx-xlsx';
import { MainChannelDiversionModule } from './pages/main-channel-diversion/main-channel-diversion.module';
import { WelcomeComponent } from './pages/welcome/welcome.component';
import { CustomEntryComponent } from './pages/entry/entry.component';

const DEFAULT_SWIPER_CONFIG: SwiperConfigInterface = {
    observer: true,
    direction: 'horizontal',
    threshold: 10,
    spaceBetween: 3,
    slidesPerView: 5,
    centeredSlides: false
};
registerLocaleData(zh);

@Component({
    selector: 'app-entry',
    template: `
        <router-outlet></router-outlet>
    `
})
export class EntryComponent {
}

@NgModule({
    declarations: [
        EntryComponent,
        AppComponent,
        LoginComponent,
        CustomEntryComponent,
        WelcomeComponent,
        IrrigationComponent],
    imports: [
        BrowserModule,
        AppRoutingModule,
        IconsProviderModule,
        NgZorroAntdModule,
        FormsModule,
        ReactiveFormsModule,
        HttpClientModule,
        BrowserAnimationsModule,
        CoreModule,
        ComponentsModule,
        SystemManageModule,
        SearchMaintainModule,
        MainChannelDiversionModule,
        NgxXLSXModule
    ],
    providers: [
        { provide: HTTP_INTERCEPTORS, useClass: BaseInterceptor, multi: true },
        { provide: LocationStrategy, useClass: HashLocationStrategy },
        { provide: NZ_I18N, useValue: zh_CN },
        { provide: SWIPER_CONFIG, useValue: DEFAULT_SWIPER_CONFIG }
    ],
    bootstrap: [EntryComponent]
})
export class AppModule {
}
